package com.gshrms.org.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gshrms.common.exception.org.OrgPostGradeExistsException;
import com.gshrms.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gshrms.org.mapper.OrgPostGradeMapper;
import com.gshrms.org.domain.OrgPostGrade;
import com.gshrms.org.service.IOrgPostGradeService;

/**
 * 职等Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-10-28
 */
@Service
public class OrgPostGradeServiceImpl extends ServiceImpl<OrgPostGradeMapper,OrgPostGrade> implements IOrgPostGradeService
{
    @Autowired
    private OrgPostGradeMapper orgPostGradeMapper;

    /**
     * 查询职等
     * 
     * @param postGradeId 职等主键
     * @return 职等
     */
    @Override
    public OrgPostGrade selectOrgPostGradeByPostGradeId(Long postGradeId)
    {
        return orgPostGradeMapper.selectOrgPostGradeByPostGradeId(postGradeId);
    }

    /**
     * 查询职等列表
     * 
     * @param orgPostGrade 职等
     * @return 职等
     */
    @Override
    public List<OrgPostGrade> selectOrgPostGradeList(OrgPostGrade orgPostGrade)
    {
        return orgPostGradeMapper.selectOrgPostGradeList(orgPostGrade);
    }

    /**
     * 修改职等
     *
     * @param orgPostGrade 职等
     * @return 结果
     */
    @Override
    public int insertOrgPostGrade(OrgPostGrade orgPostGrade)
    {
        orgPostGrade.setPostGradeId(orgPostGrade.getPostGradeNum());
        orgPostGrade.setCreateTime(DateUtils.getNowDate());
        return orgPostGradeMapper.insertOrgPostGrade(orgPostGrade);
    }

    /**
     * 修改职等
     *
     * @param orgPostGrade 职等
     * @return 结果
     */
    @Override
    public int updateOrgPostGrade(OrgPostGrade orgPostGrade)
    {
        orgPostGrade.setCreateTime(DateUtils.getNowDate());
        return orgPostGradeMapper.updateOrgPostGrade(orgPostGrade);
    }

    /**
     * 批量删除职等
     * 
     * @param postGradeIds 需要删除的职等主键
     * @return 结果
     */
    @Override
    public int deleteOrgPostGradeByPostGradeIds(Long[] postGradeIds)
    {
        return orgPostGradeMapper.deleteOrgPostGradeByPostGradeIds(postGradeIds);
    }

    /**
     * 删除职等信息
     * 
     * @param postGradeId 职等主键
     * @return 结果
     */
    @Override
    public int deleteOrgPostGradeByPostGradeId(Long postGradeId)
    {
        return orgPostGradeMapper.deleteOrgPostGradeByPostGradeId(postGradeId);
    }
}
